package com.shms.service.impl;

import java.util.List;

import com.shms.bean.GroupOfMessage;
import com.shms.bean.IndexParam;
import com.shms.dao.ShMessageDao;
import com.shms.entity.ShMessage;
import com.shms.service.ShMessageService;

/**
 * 文件名：ShMessageServiceImpl.java
 * 编写者：杨勇
 * 创建时间：2013-4-12
 * 简要描述：
 * 
 */
public class ShMessageServiceImpl implements ShMessageService {
	private ShMessageDao shMessageDao;
	
	public List<ShMessage> queryMessageByExample(IndexParam indexParam) {
		return shMessageDao.queryMessageByExample(indexParam);
	}
	
	public GroupOfMessage queryMessage(GroupOfMessage groupOfMessage) {
		if (groupOfMessage.getType().equals("forward")) {
			int currentPage = groupOfMessage.getCurrentPage() - 2;
			groupOfMessage.setCurrentPage(currentPage);
		}
		return shMessageDao.queryMessage(groupOfMessage);
	}
	
	public boolean saveMessage(ShMessage shMessage) {
		return shMessageDao.saveMessage(shMessage);
	}
	
	public ShMessage queryById(ShMessage shMessage) {
		return shMessageDao.queryById(shMessage);
	}

	public ShMessageDao getShMessageDao() {
		return shMessageDao;
	}

	public void setShMessageDao(ShMessageDao shMessageDao) {
		this.shMessageDao = shMessageDao;
	}
}
